<?php
/**
 *
 * @package 
 * @since 1.0
 */
 
class SystemAction extends Action{
	/**
	 * ------------------------------
	 * 预处理
	 * ------------------------------
	 */
	function _initialize(){
		if( !isset($_SESSION['adm_name']) or !isset($_SESSION['isAdmin']) ) $this->redirect('Index/login');
	}
	/**
	 * ------------------------------
	 * 系统基本设置
	 * ------------------------------
	 */
	function sysset(){	
		$list = M('sysconfig')->order('id asc')->select();
		foreach($list as $k=>$v){
		   $data[$v['varname']] = $v['value'];
		}
		$this->assign('pagetitle','系统基本参数设置');
		$this->assign($data);
		$this->display();
	}
	
	function setsys(){
		if (!M()->autoCheckToken($_POST)){
			$this->error('非法操作');
			die();
		}
		unset($_POST['__hash__']);
		foreach ($_POST as $k=>$v) {
			$data['value'] = $v;
			M('sysconfig')->where("varname='".$k."'")->save($data);
		}
	
		$this->success("已保存！");
	}
	
	 
	 
}